package com.wpf.system.common.response;

/**
 * 数据返回工具类
 */
public class ResultUtils {
    /**
     * 无参数返回
     * @return
     */
    public static ResultVO succcess() {
        return Vo(null, ResultCode.SUCCESS_CODE, null);
    }
    public static ResultVO success(String msg){ return Vo(msg,ResultCode.SUCCESS_CODE,null); }
    /**
     * 返回带参数
     * @param msg
     * @param data
     * @return
     */
    public static ResultVO success(String msg, Object data){
        return Vo(msg,ResultCode.SUCCESS_CODE,data);
    }
    public static ResultVO success(String msg, int code, Object data){
        return Vo(msg,code,data);
    }
    public static ResultVO Vo(String msg, int code, Object data) {
        return new ResultVO(msg, code, data);
    }

    /**
     * 错误返回
     * @return
     */
    public static ResultVO error(){
        return Vo(null,ResultCode.ERROR_CODE,null);
    }
    public static ResultVO error(String msg){
        return Vo(msg,ResultCode.ERROR_CODE,null);
    }
    public static ResultVO error(String msg, int code, Object data){
        return Vo(msg,code,data);
    }
    public static ResultVO error(String msg, int code){
        return Vo(msg,code,null);
    }
    public static ResultVO error(String msg, Object data){
        return Vo(msg, ResultCode.ERROR_CODE,data);
    }
}